# coding=utf8
import glgui2
import pyglet

class guiMainMenu():
    
  def start_game(self,s):
      pass#self.start_game.transmit(None)
  
  def quit_game(self,s):
    pyglet.app.exit()
      
  def start_editor(self,s):
    print 'editor'
    
  def hide(self):
      self.layout.visible = False
 
  def show(self):
      self.layout.visible = True
 
  def __init__(self):
      self.layout = glgui2.CentralLayout((1024,768))
      self.layout.add_widget(glgui2.Button('main/start',u'Быстрая миссия'))
      self.layout.add_widget(glgui2.Button('main/editor',u'Редактор Карт и Миссий'))
      self.layout.add_widget(glgui2.Button('main/planner',u'Оперативный план'))
      
      self.layout.add_widget(glgui2.Button('main/multiplayer',u'Сетевая игра'))
      
      
      self.layout.add_widget(glgui2.Button('main/quit',u'Выход'))
      self.layout.update_rect()
      
      
      #self.start_game = glgui2.common_signals.create_channel('engine_events/game/start_game')
    
      glgui2.common_signals.connect_to_channel('gui_events/on_click/main/start',self.start_game)
      glgui2.common_signals.connect_to_channel('gui_events/on_click/main/quit',self.quit_game)
      glgui2.common_signals.connect_to_channel('gui_events/on_click/main/editor',self.start_editor)
    
  def draw(self):
    self.layout.draw()
